home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / d86v311a.arc / 03REQ.DOC < prev    next >
Text File  |  1987-09-25  |  17KB  |  388 lines

  1. CHAPTER 3   REQUIREMENTS AND OPERATION                        3-1
  2.  
  3. System Requirements for D86
  4.  
  5. D86 currently requires an IBM-PC or compatible computer, or a
  6. Texas Instruments TI-PC, a Wang PC, Tandy 2000, or a Sanyo 550 or
  7. 555 computer.  The computer must be running MS-DOS V2.00 or
  8. later.  The IBM compatibility must exist at the BIOS and video
  9. interface levels: D86 calls the BIOS to obtain keystrokes and
  10. video status information; and, on an IBM-PC, D86 writes directly
  11. to video memory at segment B000 (if the BIOS says monochrome) or
  12. B800 (if color).
  13.  
  14. D86's memory requirements consist of 64K plus the combined sizes
  15. of D86.COM and A86.COM, plus the memory required by the program
  16. being debugged.  Thus, D86 will work in a 256K system, as long as
  17. there aren't too many resident programs chewing up memory.  If
  18. there are, D86 will tell you.
  19.  
  20. I will be happy to work with you to add support for your non-IBM-
  21. PC compatible MS-DOS computer.  See the end of this chapter for
  22. the first steps in helping me do so.
  23.  
  24.  
  25. Invoking D86
  26.  
  27. You invoke D86 by issuing the command
  28.  
  29.    D86 [+V] [progname [command-tail]]
  30.  
  31. where progname is the name of the program you are debugging.  In
  32. other words, you type a program invocation line just as if you
  33. were about to execute the program without a debugger, except that
  34. you append D86 before the line.
  35.  
  36. The following sections describe in detail the elements of the D86
  37. invocation line, and how D86 acts on them.
  38.  
  39.  
  40.  
  41. Finding the Program File
  42.  
  43. On most other debuggers, you have to give the full file name,
  44. with an explicit extension and a specific directory.  With D86,
  45. you don't: D86 uses almost the same algorithm for locating a
  46. program file that COMMAND.COM does:
  47.  
  48. 1. Look for COM, then EXE, then BAT in the current directory.
  49.  
  50. 2. Look for COM, then EXE, then BAT in each directory in turn
  51.    given in the PATH environment variable.
  52.                                                              3-2
  53.  
  54. The one difference is that D86 will look only for one extension
  55. if you give an explicit extension (and it doesn't have to be COM,
  56. EXE, or BAT).  COMMAND.COM ignores the extension you give-- I
  57. thought that was just too absurd, and didn't duplicate it.
  58.  
  59. A strange feature that I did duplicate is COMMAND.COM's lack of
  60. concern for whether the program is named COM or EXE.  If the
  61. program file begins with a valid EXE header, it's treated as an
  62. EXE no matter what it is named.  If not, then it's treated as a
  63. COM file.
  64.  
  65. D86 provides limited support for BAT files.  (That's better than
  66. other debuggers, which provide no support.)  If your program is a
  67. BAT file, D86 reads the first line of the file and pretends that
  68. that was what you typed following "D86" in your invocation.  The
  69. D86 status screen (gotten via Ctrl-S) gives you this line, and
  70. tells you what BAT file it came from.
  71.  
  72. The BAT file limitations are that D86 doesn't skip over remark
  73. lines, doesn't substitute batch-file parameters, and doesn't
  74. perform console redirection specified in the batch-file line.
  75.  
  76. You can also invoke D86 with no progname.  The debugger comes up
  77. with no program loaded, allowing you to simply poke around the
  78. machine.
  79.  
  80. If D86 had a problem loading your program, you'll see all NOPs in
  81. memory instead of instructions.  You can type Ctrl-S to get the
  82. status screen that tells you what the problem was.
  83.  
  84.  
  85.  
  86. Finding the Symbols File
  87.  
  88. D86 is a symbolic debugger.  It uses a special .SYM file produced
  89. either by the A86 assembler, or by the W command of a previous
  90. D86 debugger session.  When invoked, D86 looks for a file with
  91. the program's name and a .SYM extension.  D86 first looks in the
  92. current directory for this file, and then in each directory
  93. specified in the PATH environment variable.
  94.  
  95. It is not necessary for the SYM file to exist.  If there is no
  96. SYM file, the debugger simply comes up with no user symbols
  97. defined.  You'll also get no user symbols if the SYM file was not
  98. of a format produced by the current versions of A86 and D86.  If
  99. you were expecting symbols and didn't get any, you can press
  100. Ctrl-S to get the status screen that tells you what the problem
  101. was.
  102.                                                              3-3
  103. Two-Screen Debugging with +V
  104.  
  105. The +V option can be used if you have both a monochrome and a
  106. color monitor.  You invoke D86 when the operating system is on
  107. the color monitor-- with the +V switch, the debugger will appear
  108. on the monochrome monitor, and program console output will appear
  109. on the color monitor.
  110.  
  111. Sorry, but the +V option doesn't currently work the other way
  112. around.  I hope to conduct a session on a two-monitor system in
  113. Chicago this fall, to correct the problem.
  114.  
  115.  
  116.  
  117. The D86 Screen Display
  118.  
  119. When D86 starts up, it generates a full-screen display, and
  120. awaits your debugger commands.
  121.  
  122. In the top part of the screen is a symbolic disassembly of the
  123. A86 program, with the screen cursor positioned next to the
  124. instruction pointed to by the 8086 instruction pointer.
  125.  
  126. In the lower right corner is a fixed display of the complete 8086
  127. register set.
  128.  
  129. At the top of the second column of the register-set display is a
  130. display of the 8086 flags.  Each flag displays as blank if the
  131. flags is off; and a lower-case letter if the flag is on:
  132.           "o" for overflow,
  133.           "d" for direction,
  134.           "i" for interrupts enabled,
  135.           "s" for sign,
  136.           "z" for zero,
  137.           "a" for auxiliary carry,
  138.           "e" for parity even, and
  139.           "c" for carry.
  140.  
  141. Across the bottom line of the screen is a display of the contents
  142. of the user stack.  The display begins next to the SP register
  143. value, with the number of elements on the stack.  (The stack is
  144. assumed to have 0 elements when SP is at its original value,
  145. which is 0FFFE for COM files, and a value specified in the
  146. header record for EXE files). The number of elements is followed
  147. by a colon, followed by as many of the top stack elements as fits
  148. on the line.  The initial display will have zero elements;
  149. nothing is yet on the stack.
  150.  
  151. To the right of the registers are 6 lines, numbered 1 through 6.
  152. On these lines, you can generate windows into 8086 memory,
  153. displaying bytes, words, or ASCII text in a variety of formats.
  154. The windows can be located either at absolute memory locations,
  155. or be pointed to by any of the 8086 registers.  The commands you
  156. issue to generate these windows are described in Chapter 6.
  157.                                                              3-4
  158. D86 Commands
  159.  
  160. There are 5 kinds of activities you perform in D86:
  161.  
  162.    1. Issuing assembly-language commands for immediate execution
  163.    2. Issuing debugger commands via lines that begin with a
  164.       single letter
  165.    3. Issuing debugger commands via the function, Ctrl, and edit
  166.       keys on your keyboard
  167.    4. Setting up windows displaying memory
  168.    5. Issuing assembly-language commands to enter into memory
  169.       (PatchMem)
  170.  
  171.  
  172.  
  173. Immediate Assembly-Language Commands
  174.  
  175. A primary part of the D86 command language is the A86 assembly
  176. language. With it, you can jump to different areas of your
  177. program, set your registers, perform arithmetic, and call any of
  178. the procedures of your program.  Simply type in any legal A86
  179. instruction, and it will be executed immediately.
  180.  
  181. JMP and RET instructions cause the program counter (and thus also
  182. the disassembly) to move to the indicated destination.  CALL
  183. instructions cause the entire procedure to be executed.
  184.  
  185. WARNING: The immediate-execution feature is a little tricky if
  186.   you are in a multi-segment program, of if you jump to exotic
  187.   parts of the 86 memory space (i.e., into MSDOS, ROM, video
  188.   memory, or the interrupts table). This is because D86 needs a
  189.   buffer in which to put the immediate-execution command.  The
  190.   buffer should be in your program's CS segment, so that commands
  191.   such as jumps and near calls execute correctly.  So D86 must
  192.   always search in CS for a satisfactory buffer.  Here is how
  193.   D86 finds it:
  194.  
  195.   1. If you declare a label D86_BUFFER, pointing to a buffer
  196.      within your program, then D86 will use that buffer as the
  197.      offset for its immediate instruction.
  198.  
  199.   2. If not, then if the program's CS register is the same as its
  200.      SS register, D86 will use (SP-300) as its immediate buffer.
  201.      Thus, your stack should have plenty of room (a good practice
  202.      in general).
  203.  
  204.   3. As a last resort, D86 uses offset 00E0, which points to the
  205.      last 32 bytes of the Program Segment Prefix (PSP).  In that
  206.      case, if you were to issue an immediate command that read
  207.      from a disk file, you would be in trouble, because the disk-
  208.      read operation clobbers the PSP, and the command would then
  209.      not be trapped back to the debugger.
  210.                                                              3-5
  211.  
  212.   In cases 1 and 3 above, the segment containing the buffer is
  213.   the program's CS segment, unless that is out of range (below
  214.   the program's original CS, or above the top of available
  215.   program memory).  If the program CS is out of range, the
  216.   program's original CS is used instead.  In that case, immediate
  217.   instructions such JMP, RET, and CALL will not work correctly.
  218.  
  219.   Note that the above caveats do not apply to single-stepping.
  220.  
  221.  
  222.  
  223. Entering Instructions Into Memory
  224.  
  225. D86 allows you to alter 8086 memory in two ways: first, you can
  226. issue immediate assembly language commands which, when executed,
  227. store values in memory.  The other method is to enter a special
  228. mode, in which you enter instructions directly into 8086 memory.
  229.  
  230. You enter this mode by typing the F7 (PatchMem) key. The screen
  231. cursor jumps from the left edge of the line at the current
  232. program counter, into the middle of the line where the
  233. instruction is.  You start typing over the instruction, to signal
  234. that you are clobbering the instruction that was there.  If you
  235. did not intend to enter this mode, you can backspace back to the
  236. start of the instruction, and type a carriage-return.
  237.  
  238. Each line you type in is checked for errors.  If there was an
  239. error, a message is displayed, the cursor remains at the same
  240. location, and you try again. If there was no error, the cursor
  241. moves beyond the newly-assembled line, and you can type in
  242. another line.
  243.  
  244. To exit the memory-programming mode, you type any of the control-
  245. key commands at the beginning of the line.  (Type carriage-return
  246. if you don't want any actions to be performed.)
  247.  
  248.  
  249. Entering Data into 8086 Memory
  250.  
  251. You can deposit data into the 8086 memory space by using the
  252. programming mode described in the above section.  Simply enter DB
  253. and/or DW statements instead of instructions.  Note that ASCII
  254. strings can be entered with the DB instruction; and that arrays
  255. can be initialized via the DUP operator in a DB or DW statement.
  256.                                                              3-6
  257. Adding Symbols to a Program
  258.  
  259. Patch-mode also allows you to do something that you cannot do in
  260. immediate-execution mode: add symbols to the program.  You can do
  261. so by either:
  262.  
  263.    1. Typing in a new symbol-name, followed by a colon; or
  264.    2. Typing in an EQU directive.
  265.  
  266. There are several uses for this.  First, you might want to create
  267. an abbreviation, by equating a short name to a long one, or to a
  268. hard-to-remember constant value.  Second, you might want to
  269. "reverse engineer" a program for which you have a .COM file, but
  270. not the A86 source code.  Each time you add a label, the
  271. disassembly becomes more readable.  Third, you might want to
  272. label code that you have added in patch-mode.
  273.  
  274. After you have added symbols to the table, you can save the
  275. resulting expanded table with the W command.  Simply type W
  276. followed by the ENTER key at the main debugger command level.
  277.  
  278. Forward referencing is allowed when you are in patch mode.  You
  279. must be careful, however, to resolve any forward references you
  280. have made.  In particular, you will cause the assembler to become
  281. very confused if you overwrite a forward reference with some
  282. other code before you resolve the reference.  So don't!
  283.  
  284.  
  285.  
  286. What to Do if D86 Doesn't Work on Your Computer
  287.  
  288. If D86 does not work properly on your system, I would like to
  289. hear about it.
  290.  
  291. If you saw no debugger screen at all when you tried executing D86
  292. HEXOUT, try D86 +V HEXOUT.  Let me know what happens then.
  293.  
  294. I have written a tool called D86CHECK, that outputs information
  295. about your computer system.  Please run D86CHECK to get that
  296. information.  If you are sending me a letter in the mail, you can
  297. direct output to your printer; e.g., D86CHECK >PRN.  If you are
  298. sending me a disk, or a message on the bulletin board, you can
  299. redirect output to a file; e.g. D86CHECK >OUTFILE.
  300.  
  301. Give me the output to D86CHECK, and tell me as much as you can
  302. about the problems you are experiencing.  Also tell me the brand
  303. and model of your computer.  I'll try to see to it that the
  304. problem is fixed.
  305.  
  306. Again, my phone number is (812)339-1811.  I also receive BBS mail
  307. at (812)335-7252 and (812)332-7227.  My address is:
  308.  
  309.    Eric Isaacson
  310.    416 E. University Street
  311.    Bloomington, IN 47401
  312.                                                              3-7
  313. If You'd Like to Be Ambitious
  314.  
  315. If you are skilled in assembly-language programming, you can
  316. write the BIOS interface routines for D86 yourself, and send them
  317. to me.  That's probably the quickest way you'll get D86 up on
  318. your computer.  I have provided the source module BIOS.8 that
  319. tells you how to do this.  You must add code to BIOS.8 to detect
  320. your machine, take a BIOS keystroke, ring the bell, and copy to
  321. your video memory.  I have also provided a module XBIOS.8 to test
  322. what you have done.  Read the files XBIOS.8 and BIOS.8 for the
  323. details.  If you do not feel up to actually making the
  324. modifications yourself, then you can send me sufficient
  325. documentation about your computer, that would let me do so.  If
  326. you do not know where such documentation exists, ask your
  327. computer dealer or your user's group.
  328.  
  329. IMPORTANT NOTE: My efforts in porting D86 are done with the
  330. understanding that you will become a registered user.  I would
  331. prefer that you register in advance; if this makes you nervous,
  332. then I will accept a written promise from you that you will
  333. register when I get D86 working on your machine.  (Advance
  334. registrants will get the fastest turnaround.)  I will grant
  335. Sysop-status to those of you who are the first to write the
  336. program for your machine: i.e., if you can persuade five other
  337. users to register (and mention your name when they do so), I'll
  338. refund your registration.
  339.  
  340. In summary, in order to get D86 up and running on your machine as
  341. quickly as possible, you should send four things:
  342.  
  343. 1. Your registration fee for D86 (and A86, if you plan to use it).
  344.  
  345. 2. The output to D86CHECK as run on your machine.
  346.  
  347. 3. The modified BIOS.8, that produces an XBIOS that works on your
  348.    machine.
  349.  
  350. 4. A list of keycodes returned by your computer as reported by
  351.    XBIOS, for the keys mentioned in the following "Keyboard
  352.    Mapping Chart", as well as any interesting-looking keys in
  353.    your machine that do not exist at all on the IBM-PC.
  354.                                                              3-8
  355. Keyboard Mapping Chart
  356.  
  357. All ASCII characters should return their ASCII codes.  All
  358. function keys and special keys should return the sum of decimal
  359. 112 with the "auxiliary byte" value returned by IBM's BIOS.
  360. These (decimal) values are as shown in the following chart.  So
  361. for example, the F1 key should map to 112+59 = 171 decimal.
  362.  
  363. F1         59         Alt-0      12        Shift-Tab    15
  364. .                     Alt-hyphen 130       Home         71
  365. .                     Alt-=      131       Up arrow     72
  366. F10        68                              PgUp         73
  367.                       Alt-Q      16        Left Arrow   75
  368. Shift-F1   84         Alt-W      17        Right Arrow  77
  369. .                     Alt-E      18        End          79
  370. .                     Alt-R      19        Down Arrow   80
  371. Shift-F10  93         .                    PgDn         81
  372.                       .                    Insert       82
  373. Ctrl-F1    94         Alt-P      25        Delete       83
  374. .                                          Ctrl-PrtSc  114
  375. .                     Alt-A      30        Ctrl-Left   115
  376. Ctrl-F10  103         Alt-S      31        Ctrl-Right  116
  377.                       .                    Ctrl-End    117
  378. Alt-F1    104         .                    Ctrl-PgDn   118
  379. .                     Alt-L      38        Ctrl-Home   119
  380. .                                          Ctrl-PgUp   132
  381. Alt-F10   113         Alt-Z      44
  382.                       Alt-X      45
  383. Alt-1     120         .
  384. .                     .
  385. .                     Alt-M      50
  386. Alt-9     129
  387.  
  388.